#include "CMenuAnimation.h"
#include "SGD Wrappers/CSGD_TextureManager.h"

CMenuAnimation::CMenuAnimation()
{

}

CMenuAnimation::~CMenuAnimation()
{

}

void CMenuAnimation::Init(
	char* szImageFile, float fFrameLegth, short sFrameWidth, short sFrameHeight, short sFrameCount)
{
	m_nImageID = CSGD_TextureManager::GetInstance()->LoadTexture(szImageFile);
	m_fFrameLength = fFrameLegth;
	m_sFrameWidth = sFrameWidth;
	m_sFrameHeight = sFrameHeight;
	m_sFrameCount = sFrameCount;
}

void CMenuAnimation::Shutdown()
{

}

void CMenuAnimation::Render(int nPosX, int nPosY, short sCurrentFrame)
{
	m_drawRect.left = sCurrentFrame * m_sFrameWidth;
	m_drawRect.right = m_sFrameWidth + m_drawRect.left;
	m_drawRect.top = 0;
	m_drawRect.bottom = m_sFrameHeight;
	CSGD_TextureManager::GetInstance()->Draw(m_nImageID, nPosX, nPosY, 1, 1, &m_drawRect);
}